# 定义构建阶段
FROM golang:alpine  AS builder

# 设置工作目录
WORKDIR /app

# 复制源码
COPY . .

ENV GOPROXY https://goproxy.cn,direct

# 构建二进制文件
RUN go build main.go

# 定义运行阶段
FROM scratch

# 从 builder 阶段复制构建好的文件
COPY --from=builder /app/main /app/main

COPY --from=builder /app/config.yaml ./config.yaml

# 设置容器启动命令
CMD ["/app/main"]
